<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
   <?php echo $this->breadCrumbs(); ?>
  </div>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/report.png" alt="" /> <?php echo $_['heading_title']; ?></h1>
    </div>
    <div class="content">
      <table class="list">
        <thead>
          <tr>
            <td class="left"><?php echo $_['column_ip']; ?></td>
            <td class="left"><?php echo $_['column_customer']; ?></td>
            <td class="left"><?php echo $_['column_url']; ?></td>
            <td class="left"><?php echo $_['column_referer']; ?></td>
            <td class="left"><?php echo $_['column_date_added']; ?></td>
            <td class="right"><?php echo $_['column_action']; ?></td>
          </tr>
        </thead>
        <tbody>
          <tr class="filter">
            <td align="left"><input type="text" name="filter_ip" value="<?php echo $filter_ip; ?>" /></td>
            <td align="left"><input type="text" name="filter_customer" value="<?php echo $filter_customer; ?>" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td align="right"><a onClick="filter();" class="button">Filter</a></td>
          </tr>
          <?php if ($customers) { ?>
          <?php foreach ($customers as $customer) { ?>
          <tr onmouseover="this.className='on';" onmouseout="this.className='';">
            <td class="left"><a href="http://whatismyipaddress.com/ip/<?php echo $customer['ip']; ?>" target="_blank"><?php echo $customer['ip']; ?></a></td>
            <td class="left"><?php echo !empty($customer['customer']) ? $customer['customer'] : $_['text_guest']; ?></td>
            <td class="left"><a href="<?php echo $customer['url']; ?>" target="_blank"><?php echo implode('<br/>', str_split($customer['url'], 30)); ?></a></td>
            <td class="left"><?php if ($customer['referer']) { ?>
              <a href="<?php echo $customer['referer']; ?>" target="_blank"><?php echo implode('<br/>', str_split($customer['referer'], 30)); ?></a>
              <?php } ?></td>
            <td class="left"><?php echo v5_date_format($customer['date_added'], 'd/m/Y H:i:s'); ?></td>
            <td class="right">
              [ <a href="<?php echo UA('sale/customer/update', 'customer_id=' . $customer['customer_id']); ?>" target="_blank"><?php echo $_['text_edit']; ?></a> ]
            </td>            
          </tr>
          <?php } ?>
          <?php } else { ?>
          <tr>
            <td class="center" colspan="6"><?php echo $_['text_no_results']; ?></td>
          </tr>
          <?php } ?>
        </tbody>
      </table>
      <div class="pagination"><?php echo $pagination; ?></div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
function filter() {
	url = '<?php echo UA('report/customer_online'); ?>&filter_reset=1';
	
	var filter_customer = $('input[name=\'filter_customer\']').attr('value');
	
	if (filter_customer) {
		url += '&filter_customer=' + encodeURIComponent(filter_customer);
	}
		
	var filter_ip = $('input[name=\'filter_ip\']').attr('value');
	
	if (filter_ip) {
		url += '&filter_ip=' + encodeURIComponent(filter_ip);
	}
				
	location = url;
}
//--></script> 
<?php echo $footer; ?>